<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
	<%
		pageContext.setAttribute("APP_PATH", request.getContextPath());
	%>
	<link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
	<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
	<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
	<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
	<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
	<style type="text/css">
		td {
			text-align: center;
		}
	</style>
</head>
<body>
<!-- 模态框（Modal） -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
				<h4 class="modal-title" id="myModalLabel">增加商品</h4>
			</div>
			<div class="modal-body">
				<form action="${APP_PATH }/insertGood" method="post">
					<table class="table table-striped table-hover">


						<tr>
							<td class="col-lg-3">用户名称:</td>
							<td>
								<input type="text" class="form-control" name="uname" id="t1">
							</td>
						</tr>
						<tr>
							<td class="col-lg-3">性别:</td>
							<td>
								<input name="sex" type="radio" checked="checked">男
								<input name="sex" type="radio" />女
							</td>
						</tr>
						<tr>
							<td class="col-lg-3">年龄:</td>
							<td>
								<input type="text" class="form-control" name="age">
							</td>
						</tr>
						<tr >
							<td colspan="4">
								<input type="submit" class="btn btn-success" value="增加">


							<button type="button" class="btn btn-info" data-dismiss="modal">关闭</button>
							</td>
						</tr>
					</table>
				</form>
			</div>

		</div><!-- /.modal-content -->
	</div><!-- /.modal -->
</div>

<!-- 模态框（Modal） -->
<div class="modal fade" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabe1" aria-hidden="true">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
				<h4 class="modal-title" id="myModalLabe1">修改商品</h4>
			</div>
			<div class="modal-body">
				<form action="" method="post">
					<table class="table table-striped table-hover">

						<tr>
							<td class="col-lg-3">物品名称:</td>
							<td>
								<input type="text" class="form-control" name="goodsname">
							</td>
						</tr>
						<tr>
							<td class="col-lg-3">物品编码:</td>
							<td>
								<input type="text" class="form-control" name="goodcode">
							</td>
						</tr>
						<tr>
							<td class="col-lg-3">物品价格:</td>
							<td>
								<input type="text" class="form-control" name="goodprice">
							</td>
						</tr>
						<tr>
							<td class="col-lg-3">物品库存:</td>
							<td>
								<input type="text" class="form-control" name="goodstock">
							</td>
						</tr>
						<tr >
							<td colspan="6">
								<input type="submit" class="btn btn-success" value="修改">


								<button type="button" class="btn btn-info" data-dismiss="modal">关闭</button>
							</td>
						</tr>
					</table>
				</form>
			</div>

		</div><!-- /.modal-content -->
	</div><!-- /.modal -->
</div>
<!--当前位置导航-->
	<!--表格-->
	<div class="container-fluid ">
		<div class="row">
			<div class="col-lg-12">
				<table class="table table-striped table-bordered table-hover">
					<thead>
						<tr>
							<td colspan="5">
							<div class="col-lg-10">
								<div class="input-group">
									<div class="input-group-addon">请输入类型名称:</div>
									<input type="text" class="form-control" />
								</div>
							</div>
							<div class="col-lg-2">
								<div class="text-center">
									<input type="button" class="btn btn-danger" value="查询">
								</div>
							</div>
							</td>
						</tr>
					</thead>
					<tbody>

						<tr >
							<td align="center">用户ID</td>
							<td>用户姓名</td>
							<td>用户性别</td>
							<td>用户年龄</td>
							<td>操作</td>
						</tr>
						<c:forEach items="${pageInfo.list}" var="emp">
						<tr>
							<td>${emp.id }</td>
							<td>${emp.uname}</td>
							<td>${emp.sex}</td>
							<td>${emp.age}</td>
							<td>
								<input type="button" value="删除" class="btn btn-warning">
								&nbsp;&nbsp;&nbsp;
								<a  href="" class="btn btn-success" data-toggle="modal" data-target="#myModal2">修改</a>


								<input type="text" value="${emp.id}" style="display:none" id="tt">

							</td>
						</tr>
						</c:forEach>

						<tr>
							<td colspan="6">
								<button class="btn btn-primary" id="emp_add_modal_btn">增加</button>

							</td>
						</tr>
					</tbody>
				</table>
			</div>
		</div>
	</div>

	<!-- 显示分页信息 -->
	<div class="row">
		<!--分页文字信息  -->
		<div class="col-md-6">当前 ${pageInfo.pageNum }页,总${pageInfo.pages }
			页,总 ${pageInfo.total } 条记录</div>
		<!-- 分页条信息 -->
		<div class="col-md-6">
			<nav aria-label="Page navigation">
				<ul class="pagination">
					<li><a href="${APP_PATH }/caigou/proce?pn=1">首页</a></li>
					<c:if test="${pageInfo.hasPreviousPage }">
						<li><a href="${APP_PATH }/caigou/proce?pn=${pageInfo.pageNum-1}"
							   aria-label="Previous"> <span aria-hidden="true">&laquo;</span>
						</a></li>
					</c:if>


					<c:forEach items="${pageInfo.navigatepageNums }" var="page_Num">
						<c:if test="${page_Num == pageInfo.pageNum }">
							<li class="active"><a href="#">${page_Num }</a></li>
						</c:if>
						<c:if test="${page_Num != pageInfo.pageNum }">
							<li><a href="${APP_PATH }/caigou/proce?pn=${page_Num }">${page_Num }</a></li>
						</c:if>

					</c:forEach>
					<c:if test="${pageInfo.hasNextPage }">
						<li><a href="${APP_PATH }/caigou/proce?pn=${pageInfo.pageNum+1 }"
							   aria-label="Next"> <span aria-hidden="true">&raquo;</span>
						</a></li>
					</c:if>
					<li><a href="${APP_PATH }/caigou/proce?pn=${pageInfo.pages}">末页</a></li>
				</ul>
			</nav>
		</div>
	</div>

	</div>
<script type="text/javascript">
    $("#emp_add_modal_btn").click(function(){

        //弹出模态框
        $("#myModal").modal({
            backdrop:"static"
        });
        var  uname=$("#t1").val();
        var sex=$("#t2").val();
        var age=$("#t3").val();
        //得到图书名称
		//跳转
        window.open("${pageContext.request.contextPath}/user/insertUser?uname="+uname+"&pwd="+pwd,"_self");


    });
</script>
</body>
</html>